import java.math.BigInteger;

public class problem48 {
    public static void main(String[] args) {
        BigInteger sum = BigInteger.ZERO;
        for (BigInteger start = BigInteger.ONE, end = BigInteger.valueOf(1000); start.compareTo(end) <= 0; start = start.add(BigInteger.ONE)) {
            sum = sum.add(start.pow(Integer.valueOf(start.toString())));
        }
        System.out.println(sum);
    }
}
